<cfcomponent extends="assets.calgrants.com.Base">

	<cfscript>
        import assets.calgrants.com.service.FundWorkshopService;
		this.service = new FundWorkshopService();
	</cfscript>

	<cffunction name="get" output="false" access="remote" returntype="assets.calgrants.com.bo.FundWorkshop">
		<cfreturn this.service.get(argumentCollection = arguments) />
	</cffunction>
	
	<cffunction name="query" output="false" access="public" returntype="query">
		<cfreturn this.service.read(argumentCollection = arguments) />
	</cffunction>
	
	<cffunction name="save" output="false" access="public" returntype="any">
        <cfscript>
			var fundWorkshop = "";
			var fundWorkshop_ = this.service.get(Fund_Workshop_ID = arguments.Fund_Workshop_ID);
			if (IsInstanceOf(arguments[1], "assets.calgrants.com.bo.FundWorkshop")) {
				fundWorkshop = arguments[1];
			} else {
				var args = {};
				StructAppend(args, arguments);
				args.obj = Duplicate(fundWorkshop_);
				fundWorkshop = this.service.load(argumentCollection = args);
			}
		    var validator = getValidator();
		    var validationResults = validator.validate(fundWorkshop);
		    if (validationResults.getIsSuccess()) {
                fundWorkshop.setFund_Workshop_ID(this.service.save(fundWorkshop));
                return fundWorkshop;
            } else {
                return validationResults.getFailures();
            }
        </cfscript>
	</cffunction>
	
	<cffunction name="delete" output="false" access="public" returntype="boolean">
		<cfreturn this.service.destroy(argumentCollection = arguments) />
	</cffunction>
	
	<!--- <cffunction name="saveAppeal" output="false" access="public" returntype="any">
		<cfargument name="Fund_Workshop_Appeal_ID" type="numeric" required="yes" />
		<cfargument name="Organization_ID" type="numeric" required="yes" />
		<cfargument name="Workshop_ID" type="numeric" required="yes" />
		<cfargument name="Appealed_By_ID" type="numeric" required="yes" />
		<cfargument name="Approved" type="boolean" required="yes" />
		<cfargument name="Appeal" type="string" required="yes" />
		<cfargument name="Response" type="string" required="false" default="" />
		<cfif arguments.Fund_Workshop_Appeal_ID eq 0>
			<cfquery name="saveAppeal" datasource="#getDatasource()#">
				insert into Fund_Workshop_Appeal
				(Organization_ID,
				Workshop_ID,
				Appealed_By_ID,
				Approved,
				Appeal,
				Response)
				values
				(#arguments.Organization_ID#,
				#arguments.Workshop_ID#,
				#arguments.Appealed_By_ID#,
				#arguments.Approved#,
				'#Trim(arguments.Appeal)#',
				'#Trim(arguments.Response)#')
			</cfquery>
		<cfelse>
			<cfquery name="updateAppeal" datasource="#getDatasource()#">
				update Fund_Workshop_Appeal
				set Approved = #arguments.Approved#,
				Appeal = '#Trim(arguments.Appeal)#',
				Response = '#Trim(arguments.Response)#'
				where Fund_Workshop_Appeal_ID = #arguments.Fund_Workshop_Appeal_ID#
			</cfquery>
		</cfif>
	</cffunction>
	
	<cffunction name="queryAppeals" output="false" access="public" returntype="any">
		<cfargument name="Organization_ID" type="numeric" required="yes" />
		<cfquery name="queryAppeals" datasource="#getDatasource()#">
			select *
			from Fund_Workshop_Appeal
			where Organization_ID = #arguments.Organization_ID#
			and Deleted = 0
		</cfquery>
		<cfreturn queryAppeals />
	</cffunction> --->
	
</cfcomponent>